package com.aliyun.heiyu.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class IPUtil {
    static Pattern pattern = Pattern.compile("\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b");

    public static Boolean verificationIP(String ip) {
       Matcher matcher = pattern.matcher(ip); //验证IP地址有效性

        return matcher.matches();

    }

}
